<template>
  <el-form :inline="true" class="flex flex-wrap">
    <el-form-item label="">
      <el-input
        v-model="name"
        placeholder="请选择用户"
        size="small"
        @click.native="showUsers"
      ></el-input>
    </el-form-item>

    <el-form-item label="">
      <el-button @click.prevent="$emit('on-search')" size="small" type="primary"
        >搜索</el-button
      >
    </el-form-item>
    <user-list ref="users" @set-owner="setUser" />
  </el-form>
</template>

<script>
// import typeSelect from "@/components/type-select.vue";
import { parseTime } from "@/utils/index";
import userList from "../group/user";

export default {
  components: { userList },
  data() {
    return {
      contentType: null,
      monthNo: parseTime(new Date(), "{y}{m}"),
      searchKey: null,
      messageType: "",
      type: null,
      uid: null,
      name: "",
    };
  },
  computed: {
    conditions() {
      let obj = {
        ...this.$data,
      };
      return obj;
    },
  },
  created() {
    // this.axios.get("/department-options").then((res) => {
    //   this.dep_options = res.data;
    // });
    let params = this.$route.query;
    if (params.uid) {
      this.uid = params.uid;
      this.name = params.name;
    }
  },
  methods: {
    setUser(user) {
      if (user) {
        this.uid = user.uid;
        this.name = user.displayName;
      }
    },
    showUsers() {
      this.$refs.users.open();
    },
  },
};
</script>

<style lang='scss' scoped>
</style>